function _defineProperty(t, a, e) {
    return a in t ? Object.defineProperty(t, a, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : t[a] = e, t;
}

var _ca = require("../../public/cache.js"), app = getApp();

Page({
    data: {
        loading: "show",
        onShow: "",
        ad: [],
        webInfo: {},
        men: {},
        menuData: [],
        footerData: [],
        hotgoods: {},
        attachurl: "",
        toad: {
            isHide: !1,
            title: "",
            images: "",
            url: "",
            info: "",
            path: ""
        },
        toast: {
            isHide: !1,
            content: ""
        },
        thispath: "",
        swiperCurrent: "",
        tabBarData: {
            thisurl: "",
            borderStyle: "#d9d9d9",
            backgroundColor: "#fff",
            list: []
        }
    },
    onLoad: function(t) {
        var o = this;
        app.util.footer(o), console.log(o), o.setData({
            thispath: o.route,
            "tabBarData.thisurl": o.route
        }), app.util.request({
            url: "entry/wxapp/indexinfo",
            data: {
                uniacid: app.siteInfo.uniacid
            },
            cachetime: "30",
            success: function(t) {
                var a;
                o.setData((_defineProperty(a = {
                    webInfo: t.data.webinfo,
                    ad: t.data.ad,
                    men: t.data.men,
                    hotgoods: t.data.hot,
                    menuData: t.data.indexmenu,
                    attachurl: t.data.attachurl,
                    "tabBarData.list": t.data.bottommenu,
                    "toad.title": t.data.adinfo.title,
                    "toad.info": t.data.adinfo.info,
                    "toad.url": t.data.adinfo.url
                }, "toad.title", t.data.adinfo.title), _defineProperty(a, "toad.images", t.data.adinfo.images), 
                _defineProperty(a, "toad.path", t.data.attachurl), a));
                var e = t.data.adinfo.interval, n = _ca.get("ad");
                "adendtime" != n && _ca.put("ad", "adendtime", parseInt(e)), "1" == t.data.adinfo.firing && "adendtime" != n && o.setData({
                    "toad.isHide": !0
                }), setTimeout(function() {
                    wx.setNavigationBarColor({
                        frontColor: "#000000",
                        backgroundColor: "#FFFFFF",
                        animation: {
                            duration: 400,
                            timingFunc: "easeIn"
                        }
                    }), wx.setNavigationBarTitle({
                        title: t.data.title
                    });
                }, 100);
            }
        });
    },
    onReady: function() {
        var t = this;
        setTimeout(function() {
            t.setData({
                loading: "hide"
            });
        }, 1e3);
    },
    onShow: function() {
        this.setData({
            onShow: !0
        });
    },
    onPullDownRefresh: function() {
        this.onLoad();
    },
    onHide: function() {
        this.setData({
            onShow: !1
        });
    },
    onUnload: function() {
        this.setData({
            onShow: !1
        });
    },
    onShareAppMessage: function(t) {
        var a = this, e = a.data.webInfo.companyname;
        return "button" === t.from && console.log(t.target), {
            title: e,
            path: "/" + a.data.thispath,
            success: function(t) {
                a.show("感谢分享");
            },
            fail: function(t) {
                a.show("分享取消");
            }
        };
    },
    openmap: function(t) {
        wx.openLocation({
            latitude: parseFloat(this.data.webInfo.lat),
            longitude: parseFloat(this.data.webInfo.lng),
            name: this.data.webInfo.companyname,
            address: this.data.webInfo.address,
            scale: 18
        });
    },
    navservice: function(t) {
        wx.navigateTo({
            url: t.currentTarget.dataset.url
        });
    },
    Jumpurl: function(t) {
        wx.navigateTo({
            url: t.currentTarget.dataset.url
        });
    },
    gobook: function(t) {
        wx.navigateTo({
            url: "/mii_ang/pages/book/index?gid=" + t.currentTarget.dataset.gid
        });
    },
    godetails: function(t) {
        wx.navigateTo({
            url: "0" != t.currentTarget.dataset.gid ? "/mii_ang/pages/detail/detail?gid=" + t.currentTarget.dataset.gid : "/mii_ang/pages/index/index"
        });
    },
    adclose: function(t) {
        this.setData({
            "toad.isHide": !1
        });
    },
    goto: function(t) {
        console.log(t), wx.navigateTo({
            url: t.currentTarget.dataset.url
        });
    },
    show: function(t) {
        var a = this;
        this.setData({
            "toast.isHide": !0,
            "toast.content": t
        }), setTimeout(function() {
            a.setData({
                "toast.isHide": !1
            });
        }, 2e3);
    },
    swiperChange: function(t) {
        this.setData({
            swiperCurrent: t.detail.current
        });
    }
});